package com.example.dingtalklogin.service;

import com.example.dingtalklogin.service.dto.DingtalkBindingCmd;
import com.example.dingtalklogin.service.dto.DingtalkUnBindingCmd;
import com.example.dingtalklogin.service.dto.UserLoginCmd;
import com.example.dingtalklogin.service.dto.data.UserDto;
import com.example.dingtalklogin.service.executor.DingtalkUnBindingCmdExe;
import com.example.dingtalklogin.service.executor.UserLoginCmdExe;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 登录相关的逻辑
 *
 * @author xuzhen97
 */
@Service
public class LoginService {

    @Resource
    private UserLoginCmdExe userLoginCmdExe;
    @Resource
    private DingtalkUnBindingCmdExe dingtalkUnBindingCmdExe;

    /**
     * 进行登录相关的逻辑验证
     * @param cmd
     * @return
     */
    public UserDto login(UserLoginCmd cmd){
        return userLoginCmdExe.execute(cmd);
    }

    /**
     * 解绑钉钉
     * @param cmd
     */
    public void unBindingDingtalk(DingtalkUnBindingCmd cmd){
        dingtalkUnBindingCmdExe.execute(cmd);
    }
}
